package com.itheima.mapper;

import com.itheima.pojo.user;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

/**
 * @author Azer
 * @LOVE,,,
 * @Date 2021/09/2021/9/3 19:36:41
 * @Version 1.0
 */
public interface userMapper {

    /**
     * 查询用户名是否合法
     * @param userName
     * @return
     */
    @Select("select * from user where user_name=#{userName}")
    @Results(
            {
                    @Result(column = "user_name",property = "userName"),
                    @Result(column = "user_password",property = "password")
            }
    )
    user selectUserName(String userName);


    /**
     * 添加用户
     * @param user
     * @return
     */
    @Insert("insert into user values(null,#{userName},#{password})")
    Integer addUser(user user);
}
